<script setup lang="ts">

import Child from "@/vueTest/c/07_provide-inject/Child.vue";
import {provide, reactive, ref} from "vue";
const money = ref(100)
const car = reactive({
  brand: '奔驰',
  price: 100
})

function updateMoney(value:number) {
  money.value += value
}

// 向后代提供数据
provide('moneyContext', {money, updateMoney})
provide('che', car)
</script>

<template>
<h2>父组件</h2>
  <h3>银子：{{money}}</h3>
  <h3>车子：{{car}}</h3>
  <hr>
  <Child/>
</template>

<style scoped>

</style>